#include "ball.h"

Ball::Ball(int x, int y, int radius){
    this->setX(qreal(x));
    this->setY(qreal(y));
    this->radius = radius;
}
QRectF Ball::boundingRect() const
{
    return QRectF(-radius, -radius, 2*radius, 2*radius);
}
void Ball::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
    painter->setBrush(QBrush(Qt::red, Qt::SolidPattern));
    painter->drawEllipse(this->x(),this->y(),radius,radius);
}
void Ball::advance(int step)
{
    qDebug() << this->x();
    qDebug() << this->y();
    this->setPos(this->mapToParent(qreal(0.1),0));
}

